package com.cloudbroker.bcs.csvc.base.api.constants;

import java.util.Map;

import com.cloudbroker.bcs.csvc.base.api.util.HSBCCSUtil;
import com.cloudbroker.bcs.csvc.base.api.util.HSBCCSUtil.ErrorNoReader;

public class HSBCCSBizErrorCodes {
    
    public static ErrorNoReader errorNoReader = new ErrorNoReader() {
        @Override
        public String getErrorNo(Map<String, Object> result) {
            Object errorNo = result.get(HSBCCSFields.BIZ_ERROR_NO);
            return null == errorNo ? null : String.valueOf(errorNo);
        }
    };
    
    public static boolean isSuccess(Map<String, Object> result, String successCode) {
        return HSBCCSUtil.isSuccess(result, errorNoReader, successCode);
    }
    
    public static boolean isErrorOf(Map<String, Object> result, String errorNo) {
        return HSBCCSUtil.isErrorOf(result, errorNoReader, errorNo);
    }
    
    public static boolean isErrorIn(String existsErrorNo, String... errorNos) {
        return HSBCCSUtil.isErrorIn(existsErrorNo, errorNos);
    }
    
    public static boolean isErrorIn(Map<String, Object> result, String... errorNos) {
        return HSBCCSUtil.isErrorIn(result, errorNoReader, errorNos);
    }
    
}
